#!/usr/bin/env bash

function progress() {
    local GREEN CLEAN
    GREEN='\033[0;32m'
    CLEAN='\033[0m'
    printf "\n${GREEN}$@  ${CLEAN}\n" >&2
}

set -e

# Docker image name
IMAGENAME=registry.cn-beijing.aliyuncs.com/b2btech/pay

progress "Building pay jar file ..."
mvn clean package -Dmaven.test.skip=true
progress "Building pay docker image ... "
docker tag $(docker build -t ${IMAGENAME} -q .) ${IMAGENAME}:$(date -u "+%Y%m%d-%H%M%S")